-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: make socket IPC examples more robust #13196
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a suggestion
doc/api/child_process.md
Outdated
@@ -1136,7 +1136,7 @@ const normal = require('child_process').fork('child.js', ['normal']); | |||
const special = require('child_process').fork('child.js', ['special']); | |||
|
|||
// Open up the server and send sockets to child | |||
const server = require('net').createServer(); | |||
const server = require('net').createServer({ pauseOnConnect: true }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a note why using pauseOnConnect: true
is a good practice.
doc/api/child_process.md
Outdated
@@ -1166,6 +1171,10 @@ tracking when the socket is destroyed. To indicate this, the `.connections` | |||
property becomes `null`. It is recommended not to use `.maxConnections` when | |||
this occurs. | |||
|
|||
It is also recommended that that any `'message'` handlers in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: is that repeated on purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't think so.
@cjihrig This would need a rebase :) |
Rebased and addressed comments. |
This commit aims to improve the documentation examples that send sockets over IPC channels. Specifically, pauseOnConnect is added to a server that inspects the socket before sending and a 'message' handler adds a check that the socket still exists. PR-URL: nodejs#13196 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit aims to improve the documentation examples that send sockets over IPC channels. Specifically, pauseOnConnect is added to a server that inspects the socket before sending and a 'message' handler adds a check that the socket still exists. PR-URL: #13196 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Is this applicable to v6.x? |
ping @cjihrig |
Yes, I'd say it's applicable. |
@cjihrig do you have time to backport? |
Backport in #15482 |
This commit aims to improve the documentation examples that send sockets over IPC channels. Specifically, pauseOnConnect is added to a server that inspects the socket before sending and a 'message' handler adds a check that the socket still exists. PR-URL: #13196 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit aims to improve the documentation examples that send sockets over IPC channels. Specifically, pauseOnConnect is added to a server that inspects the socket before sending and a 'message' handler adds a check that the socket still exists. PR-URL: #13196 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit aims to improve the documentation examples that send sockets over IPC channels. Specifically, pauseOnConnect is added to a server that inspects the socket before sending and a 'message' handler adds a check that the socket still exists. PR-URL: nodejs/node#13196 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit aims to improve the documentation examples that send sockets over IPC channels. Specifically,
pauseOnConnect
is added to a server that inspects the socket before sending and a'message'
handler adds a check that the socket still exists.Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
doc
R= @santigimeno